package com.gz.im.backend.pojo.enums;

import lombok.Getter;
import org.springframework.lang.Nullable;

import java.util.Arrays;
import java.util.Objects;

/**
 * @author GuoZhong
 * @description 节点操作类型枚举
 * @date 2023/3/29 10:05
 */
@Getter
public enum OperateTypeEnum {
	/**
	 *  默认无操作
	 */
	NO(0,null),

	/**
	 *   转人工
	 */
	TURN_SEAT (1,"manualNotify"),
	/**
	 *   生成工单
	 */
	CREATE_ORDER (2,"orderNotify"),
	/**
	 *   机器人结束
	 */
	ROBOT_FINISH(3,"robotFinish");


	/**
	 * 类型
	 */
	private Integer type;
	/**
	 * 描述
	 */
	private String desc;

	OperateTypeEnum(int type, String desc){
		this.type = type;
		this.desc = desc;
	}

	/**
	 * 获取operate描述
	 * @return
	 */
	public static String getDescByType(@Nullable Integer type) {
		OperateTypeEnum operateTypeEnum = Arrays.stream(OperateTypeEnum.values())
				.filter(e -> Objects.equals(e.getType(), type))
				.findFirst().orElse(null);

		return null!=operateTypeEnum ? operateTypeEnum.getDesc() : null;
	}

}
